
/******************************************************************************\
|    Title:        	 FIGUREF4: Average marginal effects of being a switcher on  |
|					 number and size of lobbying reports 					   |
|    Date:         	 July 2023	                                         	   |
|    Author:         Elisa Wirsching	      							       |
\******************************************************************************/


clear all
set more off, permanently
numlabel, add
set maxvar 32000


use lobbyist_yearly.dta, clear

gen log_total_contracts_firm = ln(total_contracts_firm)

foreach var of varlist contract_size_* {
	gen log_`var' = ln(`var'+1)
}

************************************************
** Number of contracts that lobbyists takes on

* effect positive, but not very pronounced for number of contracts
reg log_total_contracts_firm i.switcher##i.yearsinceleaving experience_imp daysworked committeestaff_everyear personalstaff_everyear senate_everyear majority_everyear minority_everyear dcoffice_everyear leaderofficestaff_everyear log_max_adjannual_pay i.year if posttreat==1, cluster(stafferid)

margins if yearsinceleaving<8, dydx(i.switcher) over(i.yearsinceleaving)

marginsplot, plotopts(connect(none) mcolor(black) lcolor(black)) graphregion(color(white)) yline(0, lcolor(black)) recastci(rspike) ciopts(lcolor(black)) title("Log number of lobbying reports", color(black)) xtitle("Year since leaving Congress") ytitle("Effect estimate for being a switcher") name(margins_numberofcontracts, replace)


*************************************************
** Average size of contracts per year that lobbyist takes on

reg log_contract_size_adj_wgt i.switcher##i.yearsinceleaving experience_imp daysworked committeestaff_everyear personalstaff_everyear senate_everyear majority_everyear minority_everyear dcoffice_everyear leaderofficestaff_everyear i.year log_max_adjannual_pay if posttreat==1, cluster(stafferid)

margins if yearsinceleaving<8, dydx(i.switcher) over(i.yearsinceleaving)

marginsplot, plotopts(connect(none) mcolor(black) lcolor(black)) graphregion(color(white)) yline(0, lcolor(black)) recastci(rspike) ciopts(lcolor(black)) title("Log average report size", color(black)) xtitle("Year since leaving Congress") ytitle("Effect estimate for being a switcher") name(margins_contractsize, replace)

graph combine margins_numberofcontracts margins_contractsize, ycommon graphregion(color(white))


